import { createBrowserRouter as Router, Navigate } from "react-router-dom";
import App from "../App";
// 首页
import Shou from "../components/Shou/Shou";
// 食物
import Food from "../components/Shou/Food/Food";
import AddFood from "../components/Shou/Food/AddFood";
// 睡眠
import Sleep from "../components/Shou/Sleep/Sleep";
import GoToSleep from "../components/Shou/Sleep/GoToSleep";
import SetTime from "../components/Shou/Sleep/SetTime";
// 饮水
import Water from "../components/Shou/Water/Water";
// 运动
import Sport from "../components/sport/sport";
import Map from "../components/sport/map";

// 我的
import My from "../components/My/Mys";
import Target from "../components/My/Target";
import Motion from "../components/My/Motion";
import Steps from "../components/My/Steps";
import Week from "../components/My/Week";
import Month from "../components/My/Month";
import Tsteps from "../components/My/Tsteps";
import Set from "../components/My/Set";

// 发现
import Found from "../components/Found/Found";

// 设备
import She from "../components/She/She";

//登录
import Login from "../components/login/Deng";
import Yan from "../components/login/Dengone";
//引入鉴权
import AuthRouter from "./withRouter";

let router = Router([
  { path: "/", element: <Navigate to="/login"></Navigate> },
  {
    path: "/app",
    element: <App></App>,
    children: [
      {
        path: "/app/shou",
        element: (
          <AuthRouter>
            <Shou></Shou>
          </AuthRouter>
        ),
      },
      { path: "/app/found", element: <Found></Found> },
      { path: "/app/she", element: <She></She> },
      { path: "/app/My", element: <My></My> },
    ],
  },

  { path: "/login", element: <Login></Login> },
  { path: "/set", element: <Set></Set> },
  { path: "/food", element: <Food></Food> },
  { path: "/addFood", element: <AddFood></AddFood> },
  { path: "/sleep", element: <Sleep></Sleep> },
  { path: "/gotosleep", element: <GoToSleep></GoToSleep> },
  { path: "/setTime", element: <SetTime></SetTime> },
  { path: "/water", element: <Water></Water> },
  { path: "/yan", element: <Yan></Yan> },
  { path: "/sport", element: <Sport></Sport> },
  { path: "/map", element: <Map></Map> },
  { path: "/target", element: <Target></Target> },
  { path: "/motion", element: <Motion></Motion> },
  { path: "/steps", element: <Steps></Steps> },
  { path: "/week", element: <Week></Week> },
  { path: "/month", element: <Month></Month> },
  { path: "/tsteps", element: <Tsteps></Tsteps> },
]);
export default router;
